package com.itheima.command;

/**
 * @author zzw
 * @date 2025/10/25
 * @description 命令模式测试类
 */
public class Client {
    public static void main(String[] args) {

        // 创建2个Order
        Order order1 = new Order();
        order1.setDiningTable(1);
        order1.getFoodDic().put("西红柿鸡蛋面", 1);
        order1.getFoodDic().put("小杯可乐", 2);

        Order order2 = new Order();
        order2.setDiningTable(2);
        order2.getFoodDic().put("尖椒肉丝盖饭", 1);
        order2.getFoodDic().put("小杯雪碧", 1);

        // 创建接收者
        SeniorChef seniorChef = new SeniorChef();
        // 将订单和接收者封装成命令对象
        Command command1 = new OrderCommand(seniorChef, order1);
        Command command2 = new OrderCommand(seniorChef, order2);
        // 创建调用者
        Waiter waiter = new Waiter();
        waiter.setCommand(command1);
        waiter.setCommand(command2);

        // 请求者发出命令：将订单带到柜台，并向厨师喊订单来了
        waiter.orderUp();
    }
}
